#ifndef MINEDESIGN3D_DBUTIL
#define MINEDESIGN3D_DBUTIL
#include <string>
#include <sstream>
#include <AntTweakBar.h>
#include "MineDesign3D/DBManager.hpp"
namespace MineDesign3D{
static TwType GetBlockTwEnum()
{
	std::stringstream ss;
	const int BLOCK_NUM = g_pDBManager()->getBlockNum();
	for(int i = 0 ; i < BLOCK_NUM ; ++i)
	{
		ss << g_pDBManager()->getBlockNameFromID(i);

		if(i+1 == BLOCK_NUM)
		{
		}
		else
		{
			ss << ",";
		}
	}

	return TwDefineEnumFromString("BlockType",ss.str().c_str());
}
static std::string GetBlockEnumDefStrRO()
{
	std::stringstream ss;
	ss << "group='SelectedInfo' enum='";

	const int BLOCK_NUM = g_pDBManager()->getBlockNum();
	for(int i = 0 ; i < BLOCK_NUM ; ++i)
	{
		ss << i << " {";
		ss << g_pDBManager()->getBlockNameFromID(i);

		ss << "}, ";
	}

	ss << "-1 {NoSelect}";
	ss << "'";

	return ss.str();
}
}//MineDesign3D
/*
	std::stringstream ss;
	ss << "group='Edit' enum='";

	const int BLOCK_NUM = g_pDBManager()->GetBlockNum();
	for(int i = 0 ; i < BLOCK_NUM ; ++i)
	{
		ss << i << " {";
		ss << g_pDBManager()->getBlockNameFromID(i);

		if(i+1 == BLOCK_NUM)
		{
			ss << "}";
		}
		else
		{
			ss << "}, ";
		}
	}
	ss << "'";

	return ss.str();
*/
#endif